Config Plugins
追加の設定が必要なNative Modulesを使用する際に使う
全てのnative modulesで必要というわけではない
native module内を触らずにnative moduleに関する設定をかける
app.jsonの"plugins: [..]"の箇所に書く
設定はλ npx expo prebuildした際に反映される
docs
めっちゃ長い
#WIP
#??
Config Pluginsが必要になるものとそうでないものの線引はなにか?
例
expo-cameraを使用する際
cameraの権限を有効にするために、設定する必要がある
code:app.json
{
"plugins": [
[
"expo-camera",
{
"locationWhenInUsePermission": "Allow $(PRODUCT_NAME) to access your location"
}
]
]
}
プラグインは、アプリアイコンの生成、アプリ名の設定、Info.plist、AndroidManifest.xmlなどの構成などを行う
使用方法
https://docs.expo.dev/guides/config-plugins/#using-a-plugin-in-your-app
app.jsonのplugins: [..]の箇所に書く
In simple cases, adding libraries outside of the Expo SDK will work fine because React Native automatically links them through Gradle and Cocoapods. But installing native module libraries often involves some additional configuration of the native projects, and prebuild only knows how to do this for Expo SDK packages.
これが何を言っているのかわからないmrsekut.icon
単純なケースでは、React NativeがGradleとCocoapodsを介してライブラリを自動的にリンクする
ExpoSDKの外部にライブラリを追加すると正常に機能する
prebuildが対応している
ただし、native module libraryのinstallには、native projectの追加構成が必要
prebuildは、これは行われない
We can solve this by giving developers hooks into the prebuild process and publicly documenting the tools we use to configure Expo SDK packages. We call these tools config plugins. ref
これを解決するのがConfig Plugins
prebuildに対するhookを提供する
ExpoSDKパッケージの構成に使用するツールを公開する
#??
prebuildの中で実行される
とある関数
Config plugins are functions that are executed during the prebuild process. They have access to utilities that make it easy to do the most common configuration tasks, and if those utilities don’t handle your use case then you can directly access the project on the filesystem as an escape hatch. Developers can pass in options to config plugins, like API keys and permission messages. Libraries can ship with their own config plugins, and app developers can use them to customize any aspect of their native projects that can be customized programmatically. ref
全然何を言っているのかわからない
ntive codeの一部で、API keyとかが必要な場合に渡せると欠か
@expo/config-plugins
https://blog.expo.dev/expo-managed-workflow-in-2021-d1c9b68aa10#:~:text=In%20simple%20cases,tools%20config%20plugins.
https://blog.expo.dev/introducing-custom-development-clients-5a2c79a9ddf8#:~:text=The%20Expo%20config,the%20rough%20edges!